const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function (app) {
  app.use(
    '/api',
    createProxyMiddleware({
      target: 'http://localhost:5000',
      changeOrigin: true,
      pathRewrite: {
        '^/api': '/'
      }
    })
  );

  app.use(
    '/chouti-imgs',
    createProxyMiddleware({
      target: 'https://img3.chouti.com',
      changeOrigin: true,
      pathRewrite: {
        '^/chouti-imgs': '/'
      }
    })
  );


};
// 此文件结合axios
// 把远程的接口通过"http://localhost:3000"直接在本地访问
// 就是跨域的一种方式


// git pull
// yarn run init
// yarn start